package doning;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

/**
 * Leetcode-10
 * Example 5:
 * Input:
 * s = "mississippi"
 * p = "mis*is*p*."
 * Output: false
 * Example 4:
 * Input:
 * s = "aab"
 * p = "c*a*b"
 * Output: true
 *
 * @author 大硕
 * 2019-03-17 7:04 PM
 **/
@Slf4j
public class RegularExpressionMatching {

    @SuppressWarnings("all")
    public boolean isMatch(String s, String p) {
        // TODO
        return false;
    }

    @Test
    public void test() {
        log.info("result:{} ",
                isMatch("a", "a"));
    }

}

























/*
public boolean isMatch(String s, String p) {
    // NO.1 判断空
    if (p.isEmpty()) {
        return s.isEmpty();
    }

    if (p.length() == 1) {
        return (s.length() == 1 && (s.toCharArray()[0] == p.toCharArray()[0] || p.toCharArray()[0] == '.'));
    }

    if (p.toCharArray()[1] != '*') {
        if (s.isEmpty()) return false;
        return (s.toCharArray()[0] == p.toCharArray()[0] || p.toCharArray()[0] == '.') && isMatch(s.substring(1), p.substring(1));
    }

    while (!s.isEmpty() && (s.toCharArray()[0] == p.toCharArray()[0] || p.toCharArray()[0] == '.')) {
        if (isMatch(s, p.substring(2))) return true;
        s = s.substring(1);
    }

    return isMatch(s, p.substring(2));
}
*/
